using UnityEngine;
using System.Collections;

public class ConfirmationStore : MonoBehaviour {

	public type typeObject;
	public GameObject confirmation;
	public GameObject dontHaveMoney;
	public GameObject Sucess;
	public buttonType typeButton;
	public int price;
	
	void OnMouseDown () 
	{
		if(typeButton == buttonType.YES)
		{
			Debug.Log(Store.souls);
			if(Store.souls > price)
			{
				if(typeObject == type.FIRST)
				PlayerPrefs.SetInt("Weapon",1);
				
				if(typeObject == type.SECOND)
				PlayerPrefs.SetInt("Weapon",2);
				
				if(typeObject == type.THIRD)
				PlayerPrefs.SetInt("Weapon",3);
				
				Store.souls -= price;
				PlayerPrefs.SetInt("Souls",Store.souls);
				confirmation.SetActive(false);
				Sucess.SetActive(true);
			}
			else
			{
				confirmation.SetActive(false);
				dontHaveMoney.SetActive(true);
			}
		}
		if(typeButton == buttonType.NO)
		{
			confirmation.SetActive(false);
		}
	}
	
	public enum type
	{
		FIRST,
		SECOND,
		THIRD
	}
	public enum buttonType
	{
		YES,
		NO
	}
}
